home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / bbs / cddk9606.zip / HEADERS.ARJ / FOSSIL.INT < prev    next >
Text File  |  1996-06-14  |  12KB  |  417 lines

  1.  
  2. { ───────────────────────────────────────────────────────────────────────── }
  3. {  FOSSIL: Fido/Opus/Seadog Standard Interface Layer support                }
  4. {  Copyright 1996 David Pinch ∙ All Rights Reserved Worldwide               }
  5. { ───────────────────────────────────────────────────────────────────────── }
  6.  
  7. UNIT FOSSIL;
  8.  
  9. {$B-} { . . . . . . . . . . . . . . . . . . . . Shortcut boolean evaluation }
  10. {$F+} { . . . . . . . . . . . . . . . . . . . .  Force far calls for safety }
  11. {$I-} { . . . . . . . . . . . . . . . . . . . Disable input/output checking }
  12. {$O+} { . . . . . . . . . . . . . . . . . . Allow this unit to be overlayed }
  13. {$Q-} { . . . . . . . . . . . . . .  Do not generate overflow-checking code }
  14. {$R-} { . . . . . . . . . . . . . . . . Do not generate range-checking code }
  15. {$S-} { . . . . . . . . . . . . . . . . Do not generate stack-checking code }
  16. {$X+} { . . . . . . . . . . . Extended syntax for pChars and function calls }
  17.  
  18. INTERFACE
  19.  
  20. CONST
  21.  
  22.   { Baud rates }
  23.  
  24.     _300 = $00 + $40 + $00; { 010----- }
  25.     _600 = $00 + $40 + $20; { 011----- }
  26.    _1200 = $80 + $00 + $00; { 100----- }
  27.    _2400 = $80 + $00 + $20; { 101----- }
  28.    _4800 = $80 + $40 + $00; { 110----- }
  29.    _9600 = $80 + $40 + $20; { 111----- }
  30.   _19200 = $00 + $00 + $00; { 000----- }
  31.   _38400 = $00 + $00 + $20; { 001----- }
  32.  
  33.  
  34.   { Communications ports }
  35.  
  36.   _COM1 = $00;
  37.   _COM2 = $01;
  38.   _COM3 = $02;
  39.   _COM4 = $03;
  40.  
  41.  
  42.   { FOSSIL status constants }
  43.  
  44.   RDA  = $01;  { AH 00000001 }
  45.   OVRN = $02;  { AH 00000010 }
  46.   THRE = $20;  { AH 00100000 }
  47.   TSRE = $40;  { AH 01000000 }
  48.   DCD  = $80;  { AL 10000000 }
  49.  
  50.  
  51.   { Flow control constants }
  52.  
  53.   XON_XOFF_Transmit = 1;
  54.   RTS_CTS           = 2;
  55.   DSR_DTR           = 4;
  56.   XON_XOFF_Receive  = 8;
  57.  
  58. TYPE
  59.  
  60.   FOSSIL_Info_Type = RECORD
  61.     Size     : Word;        { Size of structure in bytes              }
  62.     Spec     : Byte;        { Conforms to this specification          }
  63.     Version  : Byte;        { Version of this driver                  }
  64.     ASCII_ID : Pointer;     { Far pointer to ASCII ID string          }
  65.     IBSize   : Word;        { Size of inbound buffer                  }
  66.     IBFree   : Word;        { No. of bytes left in inbound buffer     }
  67.     OBSize   : Word;        { Size of outbound buffer                 }
  68.     OBFree   : Word;        { No. of bytes left in outbound buffer    }
  69.     Width    : Byte;        { Width of screen on adapter              }
  70.     Height   : Byte;        { Height of screen on adapter             }
  71.     Baud     : Byte;        { Baud code, per function 03h (see below) }
  72.     END;
  73.  
  74.     { The ASCII_ID string is null-terminated and will not contain a   }
  75.     { newline character.  The baud field uses the same format used    }
  76.     { by function 03h.  Port-specific fields are undefined if the     }
  77.     { port is FFh or invalid.                                         }
  78.  
  79.  
  80. {#Start}
  81.  
  82. FUNCTION MakeBaudCode(Baud:LongInt):Byte;
  83.   {
  84.   PURPOSE  : Constructs a baud-rate code using 8N1 settings.
  85.  
  86.   NOTES    : Bits 7, 6 and 5 of the result specify the baud rate:
  87.  
  88.                010 =   300
  89.                011 =   600
  90.                100 =  1200
  91.                101 =  2400
  92.                110 =  4800
  93.                111 =  9600
  94.                000 = 19200 (replaces old 110 baud mask)
  95.                001 = 38400 (replaces old 150 baud mask)
  96.  
  97.              Bits 4 and 3 define the parity:
  98.  
  99.                0 0 = No parity
  100.                1 0 = No parity
  101.                0 1 = Odd parity
  102.                1 1 = Even parity
  103.  
  104.              Bit 2 defines the stop bits:
  105.  
  106.                0   = 1 stop bit
  107.                1   = 1.5 bits for 5-bit characters, 2 for others
  108.  
  109.              Bits 1 and 0 define the character length:
  110.  
  111.                0 0 = 5 bits/character
  112.                0 1 = 6 bits/character
  113.                1 0 = 7 bits/character
  114.                1 1 = 8 bits/character
  115.  
  116.              This procedure assumes 8N1 (eight bits per character, no
  117.              parity, one stop bit).
  118.  
  119.   SEE ALSO : FOSSIL_Set_Baud
  120.   }
  121.  
  122.  
  123. PROCEDURE FOSSIL_Set_Baud(FOSSIL_Port:Word; Code:Byte);
  124.   {
  125.   PURPOSE  : Sets the baud rate for the specified port.
  126.  
  127.   NOTES    : 000 00 0 00
  128.                │  │ │  └─ Character length
  129.                │  │ └──── Stop bits
  130.                │  └────── Parity
  131.                └───────── Baud rate
  132.  
  133.              Refer to MakeBaudCode for an explanation of these bits.
  134.  
  135.   SEE ALSO : MakeBaudCode
  136.   }
  137.  
  138.  
  139. PROCEDURE FOSSIL_Xmit_Chr(FOSSIL_Port:Word; C:Char);
  140.   {
  141.   PURPOSE  : Transmits a character.
  142.  
  143.   NOTES    : The procedure will not return until there is room in the
  144.              outbound buffer.
  145.  
  146.   SEE ALSO : FOSSIL_Block_Write, FOSSIL_Read_Chr, FOSSIL_Xmit_Chr_No_Wait,
  147.              FOSSIL_Xmit_Str
  148.   }
  149.  
  150.  
  151. PROCEDURE FOSSIL_Read_Chr(FOSSIL_Port:Word; VAR C:Char);
  152.   {
  153.   PURPOSE  : Reads a character from the FOSSIL driver.
  154.  
  155.   NOTES    : The procedure will not return until a character is available
  156.              in the inbound buffer.
  157.  
  158.   SEE ALSO : FOSSIL_Char_Waiting, FOSSIL_Peek, FOSSIL_Xmit_Chr
  159.   }
  160.  
  161.  
  162. FUNCTION FOSSIL_Carrier_Detect(FOSSIL_Port:Word):Boolean;
  163.   {
  164.   PURPOSE  : Returns TRUE if a caller is online; FALSE if not.
  165.   }
  166.  
  167.  
  168. FUNCTION FOSSIL_Char_Waiting(FOSSIL_Port:Word):Boolean;
  169.   {
  170.   PURPOSE  : Returns TRUE if a character is waiting in the inbound buffer.
  171.  
  172.   SEE ALSO : FOSSIL_Read_Chr
  173.   }
  174.  
  175.  
  176. FUNCTION FOSSIL_Init(FOSSIL_Port:Word):Boolean;
  177.   {
  178.   PURPOSE  : Initializes the FOSSIL driver.
  179.  
  180.   NOTES    : The function must be called before any other communications
  181.              routines are called.  Returns TRUE if a FOSSIL driver is
  182.              installed; FALSE if one was not detected.
  183.  
  184.   SEE ALSO : FOSSIL_DeInit
  185.   }
  186.  
  187.  
  188. PROCEDURE FOSSIL_DeInit(FOSSIL_Port:Word);
  189.   {
  190.   PURPOSE  : Deinitializes the FOSSIL driver.
  191.  
  192.   NOTES    : You should call this procedure when exiting the program.
  193.              DTR is not affected (carrier is not dropped).
  194.  
  195.   SEE ALSO : FOSSIL_Init
  196.   }
  197.  
  198.  
  199. PROCEDURE FOSSIL_Lower_DTR(FOSSIL_Port:Word);
  200.   {
  201.   PURPOSE  : Lowers the DTR line to the modem.
  202.  
  203.   SEE ALSO : FOSSIL_Raise_DTR
  204.   }
  205.  
  206.  
  207. PROCEDURE FOSSIL_Raise_DTR(FOSSIL_Port:Word);
  208.   {
  209.   PURPOSE  : Raises the DTR line to the modem.
  210.  
  211.   SEE ALSO : FOSSIL_Lower_DTR
  212.   }
  213.  
  214.  
  215. {#Pause}
  216. FUNCTION FOSSIL_Timer_Int:Byte;
  217. FUNCTION FOSSIL_Ticks_Per_Second:Byte;
  218. FUNCTION FOSSIL_MS_Per_Tick:Word;
  219. {#Resume}
  220.  
  221.  
  222. PROCEDURE FOSSIL_Flush_Output(FOSSIL_Port:Word);
  223.   {
  224.   PURPOSE  : Transmits any data still in the outbound buffer.
  225.  
  226.   NOTES    : Control will not be returned until all of the data has been
  227.              sent.
  228.  
  229.   SEE ALSO : FOSSIL_Purge_Input, FOSSIL_Purge_Output
  230.   }
  231.  
  232.  
  233. PROCEDURE FOSSIL_Purge_Output(FOSSIL_Port:Word);
  234.   {
  235.   PURPOSE  : Discards any data in the outbound buffer.
  236.  
  237.   SEE ALSO : FOSSIL_Flush_Output, FOSSIL_Purge_Input
  238.   }
  239.  
  240.  
  241. PROCEDURE FOSSIL_Purge_Input(FOSSIL_Port:Word);
  242.   {
  243.   PURPOSE  : Discards any data in the inbound buffer.
  244.  
  245.   SEE ALSO : FOSSIL_Flush_Output, FOSSIL_Purge_Output
  246.   }
  247.  
  248.  
  249. FUNCTION FOSSIL_Xmit_Chr_No_Wait(FOSSIL_Port:Word; C:Char):Boolean;
  250.   {
  251.   PURPOSE  : Attempts to transmit a character.
  252.  
  253.   NOTES    : The function returns TRUE if room was available in the
  254.              outbound buffer; FALSE if not.
  255.  
  256.   SEE ALSO : FOSSIL_Block_Write, FOSSIL_Xmit_Chr, FOSSIL_Xmit_Str
  257.   }
  258.  
  259.  
  260. FUNCTION FOSSIL_Peek(FOSSIL_Port:Word):Char;
  261.   {
  262.   PURPOSE  : Returns the next character in the inbound buffer without
  263.              removing that character from the buffer.
  264.  
  265.   NOTES    : FFh (#255) is returned if no characters are in the buffer.
  266.  
  267.   SEE ALSO : FOSSIL_Read_Chr
  268.   }
  269.  
  270.  
  271. {#Pause}
  272. PROCEDURE FOSSIL_Read_Key_No_Wait(VAR C:Char);
  273. PROCEDURE FOSSIL_Read_Key(VAR C:Char);
  274.   { These two procedures provide access to the IBM keyboard.                }
  275.   { FOSSIL_Read_Key waits until a key is available in the keyboard buffer.  }
  276.   { FOSSIL_Read_Key_No_Wait returns immediately with FFh (#255) if          }
  277.   { a key has not been pressed.                                             }
  278.  
  279.  
  280. PROCEDURE FOSSIL_Flow_Control(FOSSIL_Port:Word; Mask:Byte);